<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fnx" uri="http://java.sun.com/jsp/jstl/functionsx" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="f" uri="http://www.sctv.com/tags/form" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/views/head.jsp"/>
    <script type="text/javascript">
        $(function () {
            $("#validForm").validate({
                submitHandler: function (form) {
                    $("#validForm input[name|='dy']").each(function () {
                        var name = $(this).attr("name");
                        $(this).attr("name", name.substring(3, name.lastIndexOf("-")));
                    });
                    form.submit();
                }
            });

          $("input[name='name']").focus();

        });

        function confirmDelete() {
            return confirm("<s:message code='confirmDelete'/>");
        }

        function optMulti(form, action, msg) {
            if (Cms.checkeds("ids") == 0) {
                alert("<s:message code='pleaseSelectRecord'/>");
                return false;
            }
            if (msg && !confirm(msg)) {
                return false;
            }
            form.action = action;
            form.submit();
            return true;
        }

        function liveSave(form, action, msg) {
            if (msg && !confirm(msg)) {
                return false;
            }
            form.action = action;
            form.submit();
            return true;
        }
    </script>
</head>
<body class="skin-blue content-body">
<jsp:include page="/WEB-INF/views/commons/show_message.jsp"/>
<div class="content-header">
    <h1>水军用户 - 上传</h1>
</div>
<c:set var="numberExist"><s:message code="vote.number.exist"/></c:set>
<div class="content">
    <div class="box box-primary">
        <div class="btn-group">
            <button class="btn btn-default" type="button"
                    onclick="location.href='list.do';"><s:message
                    code="return"/></button>
        </div>
        <form class="form-horizontal" id="validForm" action="${oprt=='edit' ? 'update' : 'save'}.do" method="post">

            <div class="box-body">
                <div class="col-sm-6">
                    <%--<f:text id="flash" name="flash" value="${bean.flash}" class="form-control required" maxlength="255"/>--%>
                    <label class="col-sm-4 control-label" style="width:233px"><em class="required"></em>用户</label>
                    <%------------------------------------------------[ 测试 ]------------------------------------%>
                    <textarea id="filesTemplateArea" style="display:none;">
						      <div style="margin-top:5px;">
						      	<div style="display:table-cell;vertical-align:middle;width:9999px;">
							      	<div class="input-group">
							      		<span class="input-group-addon"><s:message code="fileUrl"/></span>
							      		<f:text class="form-control" id="files{0}" name="filesFile" value="{1}"
                                                maxlength="255"/>
							      	</div>
				              <script>
								      $(function () {
                                        Cms.f7.uploads("files{0}", "files{0}Name", {
                                          settings: {"title": "<s:message code="webFile.chooseUploads"/>"}
                                        });
                                      });
								      </script>
						      	</div>
						      </div>
						    </textarea>
                    <script type="text/javascript">
                      var fileRowIndex = 0;
                      var fileRowTemplate = $.format($("#filesTemplateArea").val());

                      function addFileRow(url, name, length, data) {
                        var programmes = data.programmes;
                        $('#filesContainer').html("");
                        $("<input type='hidden' name='programmes' value='"+programmes+"'/>").appendTo("#filesContainer");
                        $(fileRowTemplate(fileRowIndex++, url, name, length)).appendTo("#filesContainer");
                      }

                      function filesRemove(button) {
                        var toMove = $(button).parent().parent().parent();
                        toMove.remove();
                      }

                      function filesMoveUp(button) {
                        var toMove = $(button).parent().parent().parent();
                        toMove.prev().before(toMove);
                      }

                      function filesMoveDown(button) {
                        var toMove = $(button).parent().parent().parent();
                        toMove.next().after(toMove);
                      }
                    </script>
                    <div class="col-sm-8">
                        <span id="filesSwfButton"></span>
                        <button class="btn btn-default" type="button" onclick="filesSwfUpload.startUpload();"><s:message code="upload"/></button>
                    </div>
                    <div style="display: none">
                        <button class="btn btn-default" id="filesSwfCancel" type="button"
                                onclick="filesSwfUpload.cancelQueue();" disabled><s:message code="cancel"/></button>
                        <%--<button class="btn btn-default" type="button" onclick="addFileRow('','','');"><s:message code='addRow'/></button>--%>
                    </div>
                    <div id="filesSwfProgress"></div>
                    <script type="text/javascript">
                        /*--------------------------[ 该方法上传水军评论 水军用户]----------------------------*/
                        var filesSwfUpload = Cms.swfUploadFileCommentAndUser("files", {
                          jsessionid: "<%=request.getSession().getId()%>",
                          file_size_limit: "${GLOBAL.upload.fileLimit}",
                          file_types: "${GLOBAL.upload.fileTypes}"
                        }, addFileRow,"/core/user/uploadUser.do?_site=");
                    </script>

                    <%------------------------------------------------[ 测试  Eed ]------------------------------------%>
                </div>

            </div>
        </form>
    </div>
</div>
</div>
</body>
</html>